﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DGZImp.ApsProject.Dtos
{
    
    public class Aps_Progress
    {
    }

    /// <summary>
    /// 订单排产进度列表-入参
    /// </summary>
    public class ApsProgressInDto
    {
        /// <summary>
        /// 订单类型
        /// </summary>
        public string orderType { get; set; }
        /// <summary>
        /// 产品信息
        /// </summary>
        public string materialName { get; set; }
        /// <summary>
        /// 订单号
        /// </summary>
        public string orderNo { get; set; }
        /// <summary>
        /// 页
        /// </summary>
        public int limit { get; set; } = 1;
        /// <summary>
        /// 条数
        /// </summary>
        public int rows { get; set; } = 10;
    }

    /// <summary>
    /// 订单排产进度列表-出参
    /// </summary>
    public class ApsProgressOutDto
    {
        /// <summary>
        /// 总页数
        /// </summary>
        public int total { get; set; } = 0;

        public List<OrderInfo> orders { get; set; } = new List<OrderInfo>();
        /// <summary>
        /// 工序配置项
        /// </summary>
        public List<ConfigSeq> configSeq { get; set; } = new List<ConfigSeq>();
    }

    /// <summary>
    /// 订单信息-基础信息
    /// </summary>
    public class OrderInfoBasicDto
    {
        /// <summary>
        /// 订单类型
        /// </summary>
        public string orderType { get; set; }
        /// <summary>
        /// 产品信息
        /// </summary>
        public string materialName { get; set; }
        /// <summary>
        /// 订单号
        /// </summary>
        public string orderNo { get; set; }
        public long salesOrderId { get; set; }
        public long? materialId { get; set; }
        public DateTime? contractDate { get; set; }
        public DateTime? orderDate { get; set; }
        public string customerFullName { get; set; }

        public DateTime? requiredDate { get; set; }
        public int? orderStatus { get; set; }
        public decimal? totalQty { get; set; }
        public int? orderPriority { get;set; }
        public DateTime? modifyTime { get;set; }
    }

    /// <summary>
    /// 订单信息-临时用
    /// </summary>
    public class OrderInfoTemp: OrderInfoBasicDto
    {
        public string productsCode { get; set; }
        public string moCode { get; set; }
        public string lotNo { get; set; }
        public long? groupId { get; set; } = 0;
        /// <summary>
        /// 工序状态
        /// </summary>
        public int routeControlState { get; set; } = 0;
        
    }

    /// <summary>
    /// 订单信息-返回用
    /// </summary>
    public class OrderInfo : OrderInfoBasicDto
    {
        /// <summary>
        /// 已产数量
        /// </summary>
        public decimal producedQty { get; set; }
        /// <summary>
        /// 投产日期
        /// </summary>
        public DateTime? productionDate { get; set; }
        /// <summary>
        /// 计划产出日期
        /// </summary>
        public DateTime? plannedOutputDate { get; set; }
        /// <summary>
        /// 工序状态列表
        /// </summary>
        public List<ConfigStateDto> configState { get; set; } = new List<ConfigStateDto>();
    }


    /// <summary>
    /// 工序状态
    /// </summary>
    public class ConfigStateDto
    {
        /// <summary>
        /// 工序配置项id
        /// </summary>
        public long groupId { get; set; }
        /// <summary>
        /// 工序状态 0：未开始，1：生产中，2：生产完成，3：延迟生产，4：延迟生产完成
        /// </summary>
        public int routeControlState { get; set; } = 0;
    }

    /// <summary>
    /// 工序配置项
    /// </summary>
    public class ConfigSeq
    {
        public string name { get; set; }
        public string code { get; set; }
        public int? seq { get; set; }
        public long groupId { get; set; }
    }

    /// <summary>
    /// 订单详情
    /// </summary>
    public class OrderDetail
    {
        /// <summary>
        /// 设备编码
        /// </summary>
        public string MachineCode { get; set; }
        /// <summary>
        /// 设备名称
        /// </summary>
        public string MachineName { get; set; }
        /// <summary>
        /// 工单号
        /// </summary>
        public string MoCode { get; set; }
        /// <summary>
        /// 前工单号
        /// </summary>
        public string PreMoCode { get; set; }
        /// <summary>
        /// 产品
        /// </summary>
        public string ProductsCode { get; set; }
        /// <summary>
        /// 工序状态
        /// </summary>
        public int routeControlState { get; set; }
        /// <summary>
        /// 实际产出量
        /// </summary>
        public decimal? producedQty { get; set; }
        /// <summary>
        /// 计划数量
        /// </summary>
        public decimal? planQty { get; set; }
        /// <summary>
        /// 实际开始时间
        /// </summary>
        public DateTime? productionStart { get; set; }
        /// <summary>
        /// 实际结束时间
        /// </summary>
        public DateTime? productionEnd { get; set; }
        /// <summary>
        /// 计划开始时间
        /// </summary>
        public DateTime? planStart { get; set; }
        /// <summary>
        /// 计划结束时间
        /// </summary>
        public DateTime? planEnd { get; set; }
    }
}
